package com.serenegiant.utils;

import android.hardware.usb.UsbDevice;

import com.serenegiant.usb.DeviceFilter;
import com.serenegiant.uvccamera.R;

import java.util.List;

/**
 * Author:chen'hu
 * Time:2024/8/28 9:43
 * Description:This is UsbDeviceHelps
 */
public class UsbDeviceHelps {

    public static boolean isUsbCameraDevice(UsbDevice device){
        boolean isUsbCameraDevice = false;
        List<DeviceFilter> deviceFilters = DeviceFilter.getDeviceFilters(UVCUtils.getApplication(), R.xml.device_filter);
        for(DeviceFilter filter: deviceFilters){
            if (filter != null && filter.matches(device)) {
                if (!filter.isExclude) {
                    isUsbCameraDevice = true;
                }
            }
        }
        return isUsbCameraDevice;
    }
}
